package com.saxon.Log;

import org.aopalliance.intercept.Joinpoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class Log {
    @Before ("execution(* com.saxon.UserService.*.*(..))")
    public void before () {
        System.out.println ("方法执行前");
    }

    @After ("execution(* com.saxon.UserService.*.*(..))")
    public void after () {
        System.out.println ("方法执行完毕");
    }
    @Around ("execution(* com.saxon.UserService.*.*(..))")
    public void around (ProceedingJoinPoint jp) {
        System.out.println ("环绕前");
        try {
            Object proceed = jp.proceed ();
            System.out.println (jp.getSignature ());
        } catch (Throwable throwable) {
            throwable.printStackTrace ();
        }
        System.out.println ("环绕后");
    }

}
